<%-- 
    Document   : login
    Created on : Mar 12, 2012, 8:07:17 AM
    Author     : Violet_Ink
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="js/common.js"></script>
        <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
        <title>Login</title>
        <script type="text/javascript">
            var REUSER = /^[A-Za-z]+$/
            var REPASS = /^[A-Za-z\d]{6,10}$/
            function validate(form) {
                var user = form.username.value;
                var pass = form.password.value;
                var errors = [];
                if (!REUSER.test(user)) {
                    errors[errors.length] = "You must enter a valid username";
                }
                if (!REPASS.test(pass)) {
                    errors[errors.length] = "You must enter a valid password";
                }
                if (errors.length > 0) {
                    showErrors(errors)
                    return;
                }

            }
            function showErrors(errors) {
                var msg = "There are some errors...\n";
                for (i = 0; i < errors.length; i++) {
                    var numError = i + 1;
                    msg += "\n" + numError + ". " + errors[i];
                }
                alert(msg);
            }
        </script>
    </head>
    <body id="login-bg">
    <!-- Start: login-holder -->
    <div id="login-holder">
            <div id="logo-login">
                    <a href="index.html"><img src="images/shared/logo.png" width="156" height="40" alt="" /></a>
            </div>
            <div class="clear"></div>
            <div id="loginbox">
            <div id="login-inner">
                <form action="LoginController?action=Signin" method="POST" class="signin" onsubmit="return validate(this);">
                    <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                            <th>Username</th>
                            <td><input type="text" name="username"  class="login-inp" id="usernameLogin" /></td>
                    </tr>
                    <tr>
                            <th>Password</th>
                            <td><input type="password" name="password" value="************"  onfocus="this.value=''" class="login-inp" id="passwordLogin" /></td>
                    </tr>
                    <tr>
                            <th></th>
                            <td valign="top"><input type="checkbox" class="checkbox-size" id="login-check" /><label for="login-check">Remember me</label></td>
                    </tr>
                    <tr>
                            <th></th>
                            <td><input type="submit" class="submit-login"  /></td>
                    </tr>
                    </table>
                </form>
            </div>
            <div class="clear"></div>
            <a href="" class="forgot-pwd">Forgot Password?</a>
     </div>
            <div id="forgotbox">
                    <div id="forgotbox-text">Please send us your email and we'll reset your password.</div>
                    <div id="forgot-inner">
                    <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                            <th>Email address:</th>
                            <td><input type="text" value=""   class="login-inp" /></td>
                    </tr>
                    <tr>
                            <th> </th>
                            <td><input type="button" class="submit-login"  /></td>
                    </tr>
                    </table>
                    </div>
                    <div class="clear"></div>
                    <a href="" class="back-login">Back to login</a>
            </div>
    </div>
    </body>
</html>
